package casa.depesos.app.com.http.data;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class RepayDetail implements Parcelable {

    @SerializedName("outstanding")
    @Expose
    public boolean isOverdue;

    @SerializedName("repaymentDate")
    @Expose
    public long repayTime;

    @SerializedName("lref")
    @Expose
    public String no;

    @SerializedName("totalOverdueDays")
    @Expose
    public int overDay;

    @SerializedName("totalRemain")
    @Expose
    public float remain;

    @SerializedName("installmentFee")
    @Expose
    public float fee;

    @SerializedName("totalAmount")
    @Expose
    public float total;

    @SerializedName("totalActual")
    @Expose
    public float indeed;

    @SerializedName("apsum")
    @Expose
    public String amount;

    @SerializedName("plannedInterestAmount")
    @Expose
    public float interest;

    @SerializedName("amerceAmount")
    @Expose
    public float amerce;

    @SerializedName("forfeitAmount")
    @Expose
    public float forfeit;

    @SerializedName("vatAmount")
    @Expose
    public float vat;

    @SerializedName("extension")
    @Expose
    public boolean isExtend;

    @SerializedName("issueStat")
    @Expose
    public String status;

    protected RepayDetail(Parcel in) {
        isOverdue = in.readByte() != 0;
        repayTime = in.readLong();
        no = in.readString();
        overDay = in.readInt();
        remain = in.readFloat();
        fee = in.readFloat();
        total = in.readFloat();
        indeed = in.readFloat();
        amount = in.readString();
        interest = in.readFloat();
        amerce = in.readFloat();
        forfeit = in.readFloat();
        vat = in.readFloat();
        isExtend = in.readByte() != 0;
        status = in.readString();
    }

    public static final Creator<RepayDetail> CREATOR = new Creator<RepayDetail>() {
        @Override
        public RepayDetail createFromParcel(Parcel in) {
            return new RepayDetail(in);
        }

        @Override
        public RepayDetail[] newArray(int size) {
            return new RepayDetail[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeByte((byte) (isOverdue ? 1 : 0));
        dest.writeLong(repayTime);
        dest.writeString(no);
        dest.writeInt(overDay);
        dest.writeFloat(remain);
        dest.writeFloat(fee);
        dest.writeFloat(total);
        dest.writeFloat(indeed);
        dest.writeString(amount);
        dest.writeFloat(interest);
        dest.writeFloat(amerce);
        dest.writeFloat(forfeit);
        dest.writeFloat(vat);
        dest.writeByte((byte) (isExtend ? 1 : 0));
        dest.writeString(status);
    }
}
